tinymce.create('tinymce.plugins.oschina_list_plugin', {
    init: function (ed, url) {
        ed.addCommand('oschina_insert_list', function () {
            selected = tinyMCE.activeEditor.selection.getContent();

            if (selected) {
                content = '[oschina]' + selected + '[/oschina]';
            } else {
                content = '[oschina]';
            }

            tinymce.execCommand('mceInsertContent', false, content);
        });

        alert(url);
        ed.addButton('oschina_list_button', {
            title: 'Insert oschina list',
            cmd: 'oschina_insert_list',
            image: url + '/img/oschina.ico'
        });
    }
});
tinymce.create('tinymce.plugins.oschina_content_plugin', {
    init: function (ed, url) {
        ed.addCommand('oschina_insert_content', function () {
            selected = tinyMCE.activeEditor.selection.getContent();

            if (selected) {
                content = '[oschina-content]' + selected + '[/oschina-content]';
            } else {
                content = '[oschina-content]';
            }

            tinymce.execCommand('mceInsertContent', false, content);
        });


        ed.addButton('oschina_content_button', {
            title: 'Insert oschina content',
            cmd: 'oschina_insert_content',
            image: url + '/img/oschina-content.ico'
        });
    }
});
tinymce.PluginManager.add('oschina_list_button', tinymce.plugins.oschina_list_plugin);
tinymce.PluginManager.add('oschina_content_button', tinymce.plugins.oschina_content_plugin);
